//
//  YzDownView.m
//  YiLotteryDemo
//
//  Created by 周晓瑞 on 15/9/25.
//  Copyright (c) 2015年 coderyi. All rights reserved.
//

#import "YzDownView.h"

@implementation YzDownView
-(id)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if(self)
    {
        [self initUI];
    }
    return self;
}
-(void)initUI
{
    CGFloat  sWidth = self.frame.size.width;
    CGFloat  sHeight=self.frame.size.height;
    
    self.valueLab=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, sWidth,sHeight/4.0)];
    self.valueLab.text=@"00";
    self.valueLab.backgroundColor=[UIColor redColor];
    [self addSubview:self.valueLab];
    
    
    UIButton *countBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    self.changeBtn=countBtn;
    countBtn.backgroundColor=[UIColor  grayColor];
    countBtn.frame=CGRectMake(0, self.valueLab.bounds.size.height, sWidth,sHeight*3/4.0);
   // [countBtn addTarget:self action:@selector(valueBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:countBtn];
}
-(void)valueBtnClick:(UIButton*)sender
{
    int a = self.valueLab.text.intValue;
    a++;
    
    NSString * countStr=@"";
    if(a<10&&a>=0)
    {
        countStr = [NSString stringWithFormat:@"0%d",a];
         self.valueLab.text=countStr;
    }
    else if (a>=10&&a<=99)
    {
        countStr = [NSString stringWithFormat:@"%d",a];
         self.valueLab.text=countStr;
    }
    else
    {
       
    }
   
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
